﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using One.Framework;

namespace Money.Services
{
    public static class ServiceStaticFunctions
    {
        public static IQueryable<T> OrderByPaging<T>(this IQueryable<T> query, string orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
        {
            totalRecords = query.Count();
            return query.OrderBy<T>(string.Format("{0} {1}", orderBy, orderDirection)).Skip<T>(page).Take<T>(pageSize);
        }
    }
}
